package com.example.demo.mapper;

import com.example.demo.model.Student;
import org.apache.ibatis.annotations.*;
import java.util.List;

@Mapper
public interface StudentMapper {

    @Insert("INSERT INTO student(name, age, grade) VALUES(#{name}, #{age}, #{grade})")
    void insert(Student student);

    @Delete("DELETE FROM student WHERE id = #{id}")
    void deleteById(Integer id);

    @Update("UPDATE student SET name=#{name}, age=#{age}, grade=#{grade} WHERE id=#{id}")
    void update(Student student);

    @Select("SELECT * FROM student WHERE id = #{id}")
    Student selectById(Integer id);

    @Select("SELECT * FROM student")
    List<Student> selectAll();
}